import java.util.concurrent.BrokenBarrierException;
import java.util.concurrent.CyclicBarrier;


public class Task implements Runnable{
	private CyclicBarrier mBlocked;
	private int mCount;
	

	public Task( int mCount) {
		super();
		this.mBlocked = new CyclicBarrier(mCount, new Runnable() {
			
			@Override
			public void run() {
				System.out.println("lalala");
			}
		});
		this.mCount = mCount;
	}


	@Override
	public void run() {
		System.out.println(mBlocked.getNumberWaiting()+"在等待");
		try {
			mBlocked.await();
		} catch (InterruptedException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (BrokenBarrierException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	}

}
